package com.wll.ppjoke.ui.my;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;

import com.wll.libcommon.utils.StatusBar;
import com.wll.ppjoke.R;
import com.wll.ppjoke.databinding.ActivityLayoutListBinding;

public class UserBehaviorListActivity extends AppCompatActivity {
    public static final int BEHAVIOR_FAVORITE = 0;
    public static final int BEHAVIOR_HISTORY = 1;
    private ActivityLayoutListBinding mBing;
    public static final String KEY_BEHAVIOR = "behavior";

    public static void startBehaviorListActivity(Context context, int behavior) {
        Intent intent = new Intent(context, UserBehaviorListActivity.class);
        intent.putExtra(KEY_BEHAVIOR, behavior);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        StatusBar.fitSystemBar(this);
        super.onCreate(savedInstanceState);
        mBing = DataBindingUtil.setContentView(this,R.layout.activity_layout_list);

        int behavior =getIntent().getIntExtra(KEY_BEHAVIOR, BEHAVIOR_FAVORITE);
        if (behavior == 0){
            mBing.title.setText(R.string.fragment_my_collect_list);
        } else {
            mBing.title.setText(R.string.fragment_my_history_list);
        }
        UserBehaviorListFragment fragment = UserBehaviorListFragment.newInstance(behavior);
        getSupportFragmentManager().beginTransaction().add(R.id.contanier, fragment, "userBehavior").commit();
    }
}
